package com.entity;

import com.util.VeDate;

public class Cinema {
	private String cinemaid = "C" + VeDate.getStringId();
	private String cinemaname;
	private String cityid;
	private String address;
	private String contact;
	private String memo;
	private String cityname;

	public String getCinemaid() {
		return cinemaid;
	}

	public void setCinemaid(String cinemaid) {
		this.cinemaid = cinemaid;
	}

	public String getCinemaname() {
		return this.cinemaname;
	}

	public void setCinemaname(String cinemaname) {
		this.cinemaname = cinemaname;
	}

	public String getCityid() {
		return this.cityid;
	}

	public void setCityid(String cityid) {
		this.cityid = cityid;
	}

	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getContact() {
		return this.contact;
	}

	public void setContact(String contact) {
		this.contact = contact;
	}

	public String getMemo() {
		return this.memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	public String getCityname() {
		return this.cityname;
	}

	public void setCityname(String cityname) {
		this.cityname = cityname;
	}

	/**
	 * 重写equals方法，如果对象类型是User,先比较hashcode，一致的场合再比较每个属性的值
	 */
	@Override
	public boolean equals(Object obj) {
		System.out.println("调用equals方法，当前的hashCode为："+hashCode());
		/** 对象是 null 直接返回 false **/
		if (obj == null) {
			return false;
		}
		/** 对象是当前对象，直接返回 true **/
		if (this == obj) {
			return true;
		}
		/** 判断对象类型是否是User **/
		if (obj instanceof Cinema) {
			Cinema vo = (Cinema) obj;
			/** 比较每个属性的值一致时才返回true **/
			/** 有几个对象就要比较几个属性 **/
			if (vo.cinemaid.equals(this.cinemaid) && vo.cinemaname.equals(this.cinemaname)) {
				return true;
			}
		}
		return false;
	}

	/**
	 * 重写hashcode方法，返回的hashCode一样才再去比较每个属性的值
	 */
	@Override
	public int hashCode() {
		return this.getCinemaid().hashCode() * this.getCinemaname().hashCode();
	}
}
